<?php
	include_once('function/func.php');
?>
<div class="one_category">
    <div class="one_category_line"></div>
    <div class="one_category_title">
        <h3>Sản phẩm</h3>
        <?php if(count($result)>12):?>
        <p style="font-size: 11px;color:#999999">Items per page 
            <select name="" id="" style="font-size: 11px;color:#333333">
                <option value="12">12</option>
                <option value="12">24</option>
            </select>
        </p>
        <?php endif;?>
    </div>
    <?php if($this->uri->segment(2)==''){?>
    <div class="one_category_allProducts">
    	<?php
			if($result){
				foreach($result as $r){
		?>
        <div class="one_category_OneProducts">
            <div class="img_produt"><a title="<?=$r->title?>" href="<?=PATH_URL.'products/detail/'.$r->id.''?>"><img src="<?=PATH_URL.IMAGES_PRODUCTS.$r->image.''?>" width="150" height="187" /></a></div>
            <div class="img_cart"><a href="#"><img src="<?=PATH_URL.'static/images/icon_cart.png'?>" width="46" height="46" /></a></div>
            <div class="one_category_OneProducts_text">
                <p><a title="<?=$this->uri->segment(2)?>" href="<?=PATH_URL.'products/detail/'.$r->id.''?>"><?=cutString($r->title,13,$type=' ...')?></a></p>
                <?php if($r->price_new==0 && $r->promotion==0){?>
                <h3><?=number_format($r->price_old,0,',','.');?> vnđ</h3>
                <?php }else{?>
                <h3><?=number_format($r->price_new,0,',','.');?> vnđ</h3>
                <?php }?>
            </div>									
        </div>
        <?php }}?>
    </div>
    <div class="pagination">
    
    </div>
    <?php }else{ ?>
    	<div class="detail">
        	<div class="detail_img">
            	<img src="<?=PATH_URL.IMAGES_PRODUCTS.$result->image.''?>" width="200" height="230" />
            </div>
            <div class="detail_content">
            	<h4><?=$result->title?></h4>
                <p><?=$result->detail?></p>
                <?php if($result->price_new==0 || $result->promotion==0){?>
                <p><span><?=number_format($result->price_old,0,',','.');?> vnđ</span></p>
                <?php }else{?>
                <p><b>Giá cũ: </b><span><strike><?=number_format($result->price_old,0,',','.');?> vnđ</strike></span></p>
                <p><b>Giá mới: </b><span><?=number_format($result->price_new,0,',','.');?> vnđ</span></p>
                <?php }?>
                <p>Số lượng <input type="text" name="qty" id="qty" value="1" />&nbsp;(còn 40 sản phẩm)</p>              
                <div class="detail_buy">
                    <a href="#">Mua ngay</a>
                </div>
                <div class="detail_buy_cart ">
                    <a href="#">Thêm vào giỏ hàng <img src="<?=PATH_URL.'static/images/cart.png'?>" /></a>
                </div>
            </div>
        </div>
    <?php }?>
</div><!--end one_category-->

<?php if($this->uri->segment(2)=='detail'):?>
<div class="one_category">
    <div class="one_category_line"></div>
    <div class="one_category_title">
        <h3>Cùng thể loại</h3>
        <p><a href="#">Xem thêm</a></p>
    </div>
    <div class="one_category_allProducts">
        <div class="one_category_OneProducts">
            <div class="img_produt"><a href="#"><img src="<?=PATH_URL.'static/images/product_02.jpg'?>" width="150" height="187" /></a></div>
            <div class="img_cart"><img src="<?=PATH_URL.'static/images/icon_cart.png'?>" width="46" height="46" /></div>
            <div class="one_category_OneProducts_text">
                <p><a href="#">Áo so mi nam</a></p>
                <h3>120.000 vnđ</h3>
            </div>									
        </div>
        
        <div class="one_category_OneProducts">
            <div class="img_produt"><a href="#"><img src="<?=PATH_URL.'static/images/product_02.jpg'?>" width="150" height="187" /></a></div>
            <div class="img_cart"><img src="<?=PATH_URL.'static/images/icon_cart.png'?>" width="46" height="46" /></div>
            <div class="one_category_OneProducts_text">
                <p><a href="#">Áo so mi nam</a></p>
                <h3>120.000 vnđ</h3>
            </div>									
        </div>
        
        <div class="one_category_OneProducts">
            <div class="img_produt"><a href="#"><img src="<?=PATH_URL.'static/images/product_02.jpg'?>" width="150" height="187" /></a></div>
            <div class="img_cart"><img src="<?=PATH_URL.'static/images/icon_cart.png'?>" width="46" height="46" /></div>
            <div class="one_category_OneProducts_text">
                <p><a href="#">Áo so mi nam</a></p>
                <h3>120.000 vnđ</h3>
            </div>									
        </div>
        
        <div class="one_category_OneProducts">
            <div class="img_produt"><a href="#"><img src="<?=PATH_URL.'static/images/product_02.jpg'?>" width="150" height="187" /></a></div>
            <div class="img_cart"><img src="<?=PATH_URL.'static/images/icon_cart.png'?>" width="46" height="46" /></div>
            <div class="one_category_OneProducts_text">
                <p><a href="#">Áo so mi nam</a></p>
                <h3>120.000 vnđ</h3>
            </div>									
        </div>
    </div>
</div><!--end one_category-->
<?php endif;?>